import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '任务类型',
    align: "center",
    dataIndex: 'workType_dictText'
  },
  {
    title: '包保任务对应项',
    align: "center",
    dataIndex: 'taskNum_dictText'
  },
  {
    title: '分配方式',
    align: "center",
    dataIndex: 'type_dictText'
  },
  {
    title: '排查周期',
    align: "center",
    dataIndex: 'period'
  },
  {
    title: '周期单位',
    align: "center",
    dataIndex: 'periodUnit_dictText'
  },
  {
    title: '初始排查时间',
    align: "center",
    dataIndex: 'startTime'
  },
  {
    title: '工作日历',
    align: "center",
    dataIndex: 'calendar_dictText'
  },
  {
    title: '排查人',
    align: "center",
    dataIndex: 'identifyPeople_dictText'
  },
  {
    title: '排查岗位',
    align: "center",
    dataIndex: 'identifyStation_dictText'
  },
  // {
  //   title: '工作开始日期',
  //   align: "center",
  //   dataIndex: 'workBeginTime'
  // },
  // {
  //   title: '工作结束日期',
  //   align: "center",
  //   dataIndex: 'workEndTime'
  // },
  // {
  //   title: '最近下发时间',
  //   align: "center",
  //   dataIndex: 'latestTime'
  // },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "分配方式",
    field: 'type',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "distribution_type"
    },
    //colProps: {span: 6},
  },
  {
    label: "任务类型",
    field: 'workType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "risk_work_type"
    },
    //colProps: {span: 6},
  },
  {
    label: "初始排查时间",
    field: "startTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    //colProps: {span: 6},
  },
  {
    label: "工作日历",
    field: 'calendar',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "calendar_type"
    },
    //colProps: {span: 6},
  },
  {
    label: "排查人",
    field: 'identifyPeople',
    component: 'JSelectUserByDept',
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '分配方式',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "distribution_type"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入分配方式!'},
             ];
    },
  },
  {
    label: '排查周期',
    field: 'period',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入排查周期!'},
             ];
    },
  },
  {
    label: '周期单位',
    field: 'periodUnit',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "period_type"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入周期单位!'},
             ];
    },
  },
  {
    label: '初始排查时间',
    field: 'startTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入初始排查时间!'},
             ];
    },
  },
  {
    label: '工作日历',
    field: 'calendar',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "calendar_type"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入工作日历!'},
             ];
    },
  },
  {
    label: '排查人',
    field: 'identifyPeople',
    component: 'JSelectUserByDept',
    componentProps:{
      labelKey: 'realname',
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入排查人!'},
             ];
    },
  },
  {
    label: '排查岗位',
    field: 'identifyStation',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_position,code,name"
    },
  },
  {
    label: '工作开始日期',
    field: 'workBeginTime',
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm:ss'
    },
  },
  {
    label: '工作结束日期',
    field: 'workEndTime',
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm:ss'
    },
  },
  {
    label: '最近下发时间',
    field: 'latestTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '任务类型',
    field: 'workType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "risk_work_type"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入任务类型!'},
             ];
    },
  },
  {
    label: '包保任务对应项',
    field: 'taskNum',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tb_defend_risk_task_num,code,content"
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  type: {title: '分配方式',order: 0,view: 'radio', type: 'string',},
  period: {title: '排查周期',order: 1,view: 'number', type: 'number',},
  periodUnit: {title: '周期单位',order: 2,view: 'list', type: 'string',dictCode: 'period_type',},
  startTime: {title: '初始排查时间',order: 3,view: 'datetime', type: 'string',},
  calendar: {title: '工作日历',order: 4,view: 'list', type: 'string',dictCode: 'calendar_type',},
  identifyPeople: {title: '排查人',order: 5,view: 'sel_user', type: 'string',},
  identifyStation: {title: '排查岗位',order: 6,view: 'sel_search', type: 'string',dictTable: 'sys_position', dictCode: 'name', dictText: 'code',},
  workBeginTime: {title: '工作开始日期',order: 7,view: 'time', type: 'string',},
  workEndTime: {title: '工作结束日期',order: 8,view: 'time', type: 'string',},
  latestTime: {title: '最近下发时间',order: 9,view: 'datetime', type: 'string',},
  workType: {title: '任务类型',order: 10,view: 'text', type: 'string',dictCode: 'risk_work_type',},
  taskNum: {title: '包保任务对应项',order: 11,view: 'sel_search', type: 'string',dictTable: 'tb_defend_risk_task_num', dictCode: 'content', dictText: 'code',},
};
